package com.augurit.gzcgwsp.jzfqwczz.common.web;

import java.util.List;

import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;

import com.augurit.common.base.action.CrudActionSupport;
import com.augurit.common.base.form.ResultForm;
import com.augurit.gzcgwsp.jzfqwczz.common.service.IYwYnJzfqwczzXckctpService;
import com.augurit.gzcgwsp.jzfqwczz.common.web.form.YwYnJzfqwczzXckctpForm;
import com.augurit.gzcgwsp.ywcmn.service.IBaseDistrictService;

@SuppressWarnings("serial")
@Results({
	@Result(name = CrudActionSupport.RELOAD, location = "yw-yn-jzfqwczz-xckctp.action", type = "redirect")
})
public class YwYnJzfqwczzXckctpAction extends CrudActionSupport<YwYnJzfqwczzXckctpForm>{

	
	
	@Autowired
	private IYwYnJzfqwczzXckctpService ywYnJzfqwczzXckctpService;
	
	
	public String getImages(){
		List ywYnJzfqwczzXckctpList = null;
		String ajid = this.getParameter("ajid");
		String templateCode = this.getParameter("templateCode");
		try{
			ywYnJzfqwczzXckctpList = ywYnJzfqwczzXckctpService.getImages(Long.parseLong(ajid),templateCode); 
			System.out.println(ywYnJzfqwczzXckctpList.size());
			this.renderJson(new ResultForm(true, ywYnJzfqwczzXckctpList));
		}catch(Exception e){
			e.printStackTrace();
			this.renderJson(new ResultForm(false));
 		}	
		return null;
	}
	
	public String deleteImageById(){
		String imgId = this.getParameter("imgId");
		try{
			ywYnJzfqwczzXckctpService.deleteImageById(Long.parseLong(imgId)); 
			this.renderJson(new ResultForm(true));
		}catch(Exception e){
			e.printStackTrace();
			this.renderJson(new ResultForm(false));
 		}	
		return null;
	}
	
	
	@Override
	public String delete() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String deleteMore() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String list() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected void prepareModel() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String save() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	public YwYnJzfqwczzXckctpForm getModel() {
		// TODO Auto-generated method stub
		return null;
	}

}
